		<link href="<?php echo base_url('assets/css/editor.css') ?>" rel="stylesheet"> 		
	
		<section id="home">

			<ul class="breadcrumb">
			  <li><a href="<?php echo base_url('index.php/mainController/'); ?>">Home</a> <span class="divider">/</span></li>
        <li class="active">Query Database</li>
			</ul>

			<div class="page-header">
	      <h1>Admin Query Database</h1>
	    </div>

	    <style type="text/css">
	    #editor{
	    	width: 98%;
	    	height: 190px;
	    }
	    </style>

	    <script type="text/javascript">
	    $(function(){
	    	$('#btnQuery').bind('click',function(){
	    		$.ajax({
	    			type : 'POST',
	    			url : "query",
	    			success : function(result){
              
            }
	    		});
	    	});
	    });
	    </script>

	    <style type="text/css">
			#resultQuery {
				width:100%;

				overflow:scroll;
			}
			</style>

			<div class="row">
				<div class="span10">
					<?php echo form_open(base_url('index.php/superAdminController/queryDatabase',array('class','form-horizontal'))); ?>
					<textarea id="editor" name="editor">select * from employee</textarea>

		    	<div class="control-group">
			      <div class="controls">
			        <button id="btnQuery" name="btnQuery" type="submit" class="btn btn-primary">Query</button>
			      </div>
			    </div>
			    <?php echo form_close(); ?>
			    <hr>

			    <div id="resultQuery">
						<table class="table table-striped table-condensed ">
							<?php  
							if (isset($rsQuery)) {
								$fields = $rsQuery->field_data();
								echo '<thead>';
								echo '<tr>';
								foreach($fields as $field) {
									echo '<td>'.$field->name.'</td>';
								}
								echo '</tr>';
								echo '</thead>';
								echo '<tbody>';	
								foreach ($rsQuery->result_array() as $row) {
									echo '<tr>';
									foreach ($row as $field) {
										echo '<td>'.iconv('TIS-620', 'UTF-8', $field).'</td>';
									}
									echo '</tr>';
								}
								echo '</tbody>';
							}

							?>
						</table>
						
					</div>
					<hr>
				</div>
			</div>

	   
			

 

	  </section>

      

 		
